// 定义key为常量 便于保存
const TOKENKEY = 'key'

// 保存token
const saveToken = tokenObj => {
  localStorage.setItem(TOKENKEY, JSON.stringify(tokenObj))
}
// 删除token
const removeToken = () => {
  localStorage.removeItem(TOKENKEY)
}
// 获取token
const getToken = () => {
  return JSON.parse(localStorage.getItem(TOKENKEY))
}

export { saveToken, removeToken, getToken }
